#include "whiteboard.h"
#include "ui_whiteboard.h"
#include "mainwindow.h"

#include <QPainter>
#include <QLabel>
#include <QMessageBox>

WhiteBoard::WhiteBoard(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::WhiteBoard)
{
    ui->setupUi(this);
    setWindowFlags(Qt::FramelessWindowHint | windowFlags());
    setAttribute(Qt::WA_DeleteOnClose);

    setAutoFillBackground(false);
    setAttribute(Qt::WA_TranslucentBackground,true);
    QPalette pal = palette();
    pal.setColor(QPalette::Background, QColor(0x00,0xff,0x00,0x00));
    setPalette(pal);

    this->setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint);
}

void WhiteBoard::w_changeBgColor(QString s) {
    ui->bg->setStyleSheet("#bg{background-color: "+ s +"}");
}

void WhiteBoard::w_stopDraw() {
    ui->bg->setStyleSheet("#bg{background-color: rgb(255,255,255,0)}");
}

void WhiteBoard::paintEvent(QPaintEvent *)
{

}

WhiteBoard::~WhiteBoard()
{
    delete ui;
}
